<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Tiny FTP: cmd_server.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">Tiny FTP
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle"><div class="title">cmd_server.h</div></div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00002" name="l00002"></a><span class="lineno">    2</span><span class="preprocessor">#include &lt;errno.h&gt;</span></div>
<div class="line"><a id="l00003" name="l00003"></a><span class="lineno">    3</span><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div>
<div class="line"><a id="l00004" name="l00004"></a><span class="lineno">    4</span><span class="preprocessor">#include &lt;unistd.h&gt;</span></div>
<div class="line"><a id="l00005" name="l00005"></a><span class="lineno">    5</span><span class="preprocessor">#include &lt;sys/socket.h&gt;</span></div>
<div class="line"><a id="l00006" name="l00006"></a><span class="lineno">    6</span><span class="preprocessor">#include &lt;sys/types.h&gt;</span></div>
<div class="line"><a id="l00007" name="l00007"></a><span class="lineno">    7</span><span class="preprocessor">#include &lt;sys/stat.h&gt;</span></div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#include &lt;netinet/in.h&gt;</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span><span class="preprocessor">#include &lt;arpa/inet.h&gt;</span></div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &lt;dirent.h&gt;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &lt;fcntl.h&gt;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="preprocessor">#include &quot;config.h&quot;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span><span class="preprocessor">#include &quot;ftp_server.h&quot;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__client_8c.html#ac29c297ae32acdb2172e926d5f144681">show_help</a>();</div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#a791b072f3c807a07d8f31f79234df324">server_list</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno">   16</span><span class="comment">//处理get和get操作，Msg要求同上。</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#a85d6867e8cd03abe695768d9b067d57d">server_put</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#aa50384f65cd75709e683b2c7f08581c1">server_get</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#a338cb5462d42666ddab20076f7bd982f">server_mkd</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#a37c028d5fa7f16c48ecfb86321d4c846">server_rmd</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#acde9e10e0cad1c21935492f0a6d4045d">server_del</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#a64932a67c58d957e2482e0436b7c203c">server_cwd</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#a3430c69a06c184495cd28c57f4fe0f7e">server_pwd</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#a9020d28c81a4a7ab08d2acfb369844c7">handle_port</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span><span class="keywordtype">void</span> <a class="code hl_function" href="cmd__server_8c.html#ac7ed6e7fa09e32bb518a19a70f5f5565">handle_pasv</a>(<span class="keywordtype">int</span> client_sock, <a class="code hl_struct" href="structMsg.html">Msg</a> *msg);</div>
<div class="ttc" id="acmd__client_8c_html_ac29c297ae32acdb2172e926d5f144681"><div class="ttname"><a href="cmd__client_8c.html#ac29c297ae32acdb2172e926d5f144681">show_help</a></div><div class="ttdeci">void show_help()</div><div class="ttdoc">在客户端展示帮助信息。</div><div class="ttdef"><b>Definition:</b> cmd_client.c:27</div></div>
<div class="ttc" id="acmd__server_8c_html_a338cb5462d42666ddab20076f7bd982f"><div class="ttname"><a href="cmd__server_8c.html#a338cb5462d42666ddab20076f7bd982f">server_mkd</a></div><div class="ttdeci">void server_mkd(int client_sock, Msg *msg)</div><div class="ttdoc">根据客户端给出的参数，创建相应目录。若目录已存在，将会报错。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:213</div></div>
<div class="ttc" id="acmd__server_8c_html_a3430c69a06c184495cd28c57f4fe0f7e"><div class="ttname"><a href="cmd__server_8c.html#a3430c69a06c184495cd28c57f4fe0f7e">server_pwd</a></div><div class="ttdeci">void server_pwd(int client_sock, Msg *msg)</div><div class="ttdoc">向客户端发送目前所在的工作目录。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:303</div></div>
<div class="ttc" id="acmd__server_8c_html_a37c028d5fa7f16c48ecfb86321d4c846"><div class="ttname"><a href="cmd__server_8c.html#a37c028d5fa7f16c48ecfb86321d4c846">server_rmd</a></div><div class="ttdeci">void server_rmd(int client_sock, Msg *msg)</div><div class="ttdoc">根据客户端给出的参数，删除相应目录。若目录不存在，将会报错。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:235</div></div>
<div class="ttc" id="acmd__server_8c_html_a64932a67c58d957e2482e0436b7c203c"><div class="ttname"><a href="cmd__server_8c.html#a64932a67c58d957e2482e0436b7c203c">server_cwd</a></div><div class="ttdeci">void server_cwd(int client_sock, Msg *msg)</div><div class="ttdoc">根据客户端给出的参数，改变当前工作目录。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:280</div></div>
<div class="ttc" id="acmd__server_8c_html_a791b072f3c807a07d8f31f79234df324"><div class="ttname"><a href="cmd__server_8c.html#a791b072f3c807a07d8f31f79234df324">server_list</a></div><div class="ttdeci">void server_list(int client_sock, Msg *msg)</div><div class="ttdoc">打印当前工作目录。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:62</div></div>
<div class="ttc" id="acmd__server_8c_html_a85d6867e8cd03abe695768d9b067d57d"><div class="ttname"><a href="cmd__server_8c.html#a85d6867e8cd03abe695768d9b067d57d">server_put</a></div><div class="ttdeci">void server_put(int client_sock, Msg *msg)</div><div class="ttdoc">向服务端发送文件，可选择ASCII和Binary两种模式。若文件不存在，将会报错。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:89</div></div>
<div class="ttc" id="acmd__server_8c_html_a9020d28c81a4a7ab08d2acfb369844c7"><div class="ttname"><a href="cmd__server_8c.html#a9020d28c81a4a7ab08d2acfb369844c7">handle_port</a></div><div class="ttdeci">void handle_port(int client_sock, Msg *msg)</div><div class="ttdoc">处理PORT连接的请求。扫描客户端发送的地址信息并连接，生成传递数据的套接字。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:314</div></div>
<div class="ttc" id="acmd__server_8c_html_aa50384f65cd75709e683b2c7f08581c1"><div class="ttname"><a href="cmd__server_8c.html#aa50384f65cd75709e683b2c7f08581c1">server_get</a></div><div class="ttdeci">void server_get(int client_sock, Msg *msg)</div><div class="ttdoc">从服务端获取文件，可选择ASCII和Binary两种模式。若文件不存在，将会报错。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:137</div></div>
<div class="ttc" id="acmd__server_8c_html_ac7ed6e7fa09e32bb518a19a70f5f5565"><div class="ttname"><a href="cmd__server_8c.html#ac7ed6e7fa09e32bb518a19a70f5f5565">handle_pasv</a></div><div class="ttdeci">void handle_pasv(int client_sock, Msg *msg)</div><div class="ttdoc">处理PASV连接的请求。连接成功后，将向客户端发送相应的地址信息，并生成传递数据的套接字。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:381</div></div>
<div class="ttc" id="acmd__server_8c_html_acde9e10e0cad1c21935492f0a6d4045d"><div class="ttname"><a href="cmd__server_8c.html#acde9e10e0cad1c21935492f0a6d4045d">server_del</a></div><div class="ttdeci">void server_del(int client_sock, Msg *msg)</div><div class="ttdoc">根据客户端给出的参数，删除相应文件。若文件不存在，将会报错。</div><div class="ttdef"><b>Definition:</b> cmd_server.c:257</div></div>
<div class="ttc" id="astructMsg_html"><div class="ttname"><a href="structMsg.html">Msg</a></div><div class="ttdef"><b>Definition:</b> config.h:79</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
